<template>
    <div class="percent"
         :class="{show}">
        <h1>份额</h1>
        <my-marquee :info="info.info"
                    :width="800"></my-marquee>
        <div class="channel">
            <div class="box sn"
                 :class="{'ani-bounce':step==0}">
                 <label>苏宁</label>
                <p class="val">
                    {{ info.sn ? info.sn.val : "" }}
                </p>
                <p class="per">控比：{{ info.sn ? info.sn.percent : "" }}</p>
            </div>
            <div class="box jd"
                 :class="{'ani-bounce':step==1}">
                 <label>京东</label>
                <p class="val">
                    {{ info.jd ? info.jd.val : "" }}
                </p>
                <p class="per">控比：{{ info.jd ? info.jd.percent : "" }}</p>
            </div>
            <div class="box tm"
                 :class="{'ani-bounce':step==2}">
                 <label>天猫</label>
                <p class="val">
                    {{ info.tm ? info.tm.val : "" }}
                </p>
                <p class="per">控比：{{ info.tm ? info.tm.percent : "" }}</p>
            </div>
            <div class="box gm"
                 :class="{'ani-bounce':step==3}">
                 <label>国美</label>
                <p class="val">
                    {{ info.gm ? info.gm.val : "" }}
                </p>
                <p class="per">控比：{{ info.gm ? info.gm.percent : "" }}</p>
            </div>
        </div>
        <div class="industry ">
            <div class="box tv"
                 :class="{'ani-bounce':step==4}">
                <label>彩电</label>
                <p class="val">
                    {{ info.tv ? info.tv.val : "" }}
                </p>
                <p class="per">控比：{{ info.tv ? info.tv.percent : "" }}</p>
            </div>
            <div class="box hot "
                 :class="{'ani-bounce':step==5}">
                <label>热水器</label>
                <p class="val">
                    {{ info.hot ? info.hot.val : "" }}
                </p>
                <p class="per">控比：{{ info.hot ? info.hot.percent : "" }}</p>
            </div>
            <div class="box wash"
                 :class="{'ani-bounce':step==6}">
                <label>洗衣机</label>
                <p class="val">
                    {{ info.wash ? info.wash.val : "" }}
                </p>
                <p class="per">
                    控比：{{ info.wash ? info.wash.percent : "" }}
                </p>
            </div>
            <div class="box fridge"
                 :class="{'ani-bounce':step==7}">
                <label>冰箱</label>
                <p class="val">
                    {{ info.fridge ? info.fridge.val : "" }}
                </p>
                <p class="per">
                    控比：{{ info.fridge ? info.fridge.percent : "" }}
                </p>
            </div>
            <div class="box air "
                 :class="{'ani-bounce':step==8}">
                <label>空调</label>
                <p class="val">
                    {{ info.air ? info.air.val : "" }}
                </p>
                <p class="per">控比：{{ info.air ? info.air.percent : "" }}</p>
            </div>
            <div class="box cook"
                 :class="{'ani-bounce':step==9}">
                <label>厨电</label>
                <p class="val">
                    {{ info.cook ? info.cook.val : "" }}
                </p>
                <p class="per">
                    控比：{{ info.cook ? info.cook.percent : "" }}
                </p>
            </div>
            <div class="box cool"
                 :class="{'ani-bounce':step==10}">
                <label>冷柜</label>
                <p class="val">
                    {{ info.cool ? info.cool.val : "" }}
                </p>
                <p class="per">
                    控比：{{ info.cool ? info.cool.percent : "" }}
                </p>
            </div>
        </div>
        <div class="sink box"
             v-show="false">
            <p class="val">
                {{ info.sink ? info.sink.val : "" }}
            </p>
            <template>
                <label>下沉</label>
                <span class="per">
                    增幅:{{ info.sink ? info.sink.percent : "" }}
                </span>
            </template>
        </div>
        <div class="pop box"
             v-show="false">
            <p class="val">
                {{ info.pop ? info.pop.val : "" }}
            </p>
            <template>
                <label>POP</label>
                <span class="per">
                    增幅:{{ info.pop ? info.pop.percent : "" }}
                </span>
            </template>
        </div>
        <p class="tip">份额为当月累计&emsp;&emsp;*控比：海尔份额 / 美的份额</p>
    </div>
</template>

<script>
export default {
    props: {
        info: {},
        show: {},
    },
    data() {
        return {
            step: 0,
        }
    },
    mounted() {
        this.timer = setInterval(() => {
            if (this.step < 11) {
                this.step++
            } else {
                this.step = 0
            }
        }, 800)
    },
    beforeCreated() {
        clearInterval(this.timer)
        this.step = 0
    },
}
</script>
<style lang='less' scoped>
.percent {
    width: 920px;
    height: 670px;
    position: absolute;
    left: 500px;
    top: 147px;
    background: url(../../../assets/img/home/center-bg.png);
    opacity: 0;
    z-index: -1;
    &.show {
        opacity: 1;
        z-index: 100;
    }
    h1 {
        font-size: 36px;
        font-weight: bold;
        text-shadow: 0px 0px 20px #69aaec;
        text-align: center;
        margin-bottom: 10px;
    }
    .box {
        position: absolute;
        text-align: center;

        label {
            font-size: 14px;
        }
        .val {
            font-size: 22px;
            font-weight: bold;
            color: #26dbff;
            line-height: 25px;
        }
        .per {
            font-size: 12px;
            color: #8fadcc;
        }
    }
    .channel {
        .box {
            padding-top: 0px;
            width: 110px;
            &.sn {
                height: 157px;
                background: url(../../../assets/img/home/sn-icon.png);
                left: 215px;
                top: 90px;
            }
            &.jd {
                height: 160px;
                background: url(../../../assets/img/home/jd-icon.png);
                left: 340px;
                top: 125px;
            }
            &.tm {
                height: 163px;
                background: url(../../../assets/img/home/tm-icon.png);
                left: 470px;
                top: 125px;
            }
            &.gm {
                height: 159px;
                background: url(../../../assets/img/home/gm-icon.png);
                top: 90px;
                left: 595px;
            }
        }
    }
    .industry {
        .box {
            width: 104px;
            height: 182px;
            background: url(../../../assets/img/home/blue-icon.png);
        }

        .red {
            background: url(../../../assets/img/home/red-icon.png);
        }
        .tv {
            left: 63px;
            top: 280px;
        }
        .hot {
            left: 178px;
            top: 320px;
        }
        .wash {
            left: 293px;
            top: 360px;
        }
        .fridge {
            left: 406px;
            top: 400px;
        }
        .air {
            left: 520px;
            top: 360px;
        }
        .cook {
            left: 635px;
            top: 320px;
        }
        .cool {
            left: 750px;
            top: 280px;
        }
    }
    .sink,
    .pop {
        width: 190px;
        height: 70px;
        top: 553px;
        padding-left: 70px;
        text-align: left;
        padding-top: 20px;
        .val {
            line-height: 10px;
        }
    }
    .sink {
        left: 30px;
        background: url(../../../assets/img/home/sink-icon.png);
    }
    .pop {
        right: 30px;
        background: url(../../../assets/img/home/POP-icon.png);
    }
    .tip {
        position: absolute;
        bottom: 0;
        right: 0;
        color: #8fadcc;
        font-size: 12px;
    }
    .info {
        font-size: 14px;
        line-height: 30px;
        color: #8fadcc;
        text-align: center;
    }
}
</style>